package com.example.business_oa.service;

import com.example.comment_oa.dubbo.SysUserDubbo;
import com.example.comment_oa.pojos.SysUser;
import io.seata.spring.annotation.GlobalTransactional;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

import java.util.Set;

@Service
public class SysUserService {
    @DubboReference(version = "1.0.0")
    SysUserDubbo sysUserDubbo;

    //账号新增
    @GlobalTransactional(timeoutMills = 300000)
    public int insert(SysUser sysUser){
        return sysUserDubbo.insert(sysUser);
    }
    //账号修改
    @GlobalTransactional(timeoutMills = 300000)
    public int update(SysUser sysUser){
        return sysUserDubbo.update(sysUser);
    };
    //删除
    @GlobalTransactional(timeoutMills = 300000)
    public int delete(SysUser sysUser){
        return sysUserDubbo.delete(sysUser);
    };
    //登录
    @GlobalTransactional(timeoutMills = 300000)
    public SysUser login(String username,String userPassword){return sysUserDubbo.login(username,userPassword);};
    //权限集合
    @GlobalTransactional(timeoutMills = 300000)
    public Set<String> findUserPermissionByid(int userId){return sysUserDubbo.findUserPermissionByid(userId);};
}
